package com.example.demo.model;

import com.baidu.bas.annotation.Erupt;
import com.baidu.bas.annotation.EruptField;
import com.baidu.bas.annotation.config.SkipSerialize;
import com.baidu.bas.annotation.model.TableLogic;
import com.baidu.bas.annotation.sub_field.Edit;
import com.baidu.bas.annotation.sub_field.View;
import com.baidu.bas.upms.model.base.HyperModel;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * @author liuzhenchuan@foxmail.com
 * @date 2020/12/21
 */
@Setter
@Getter
@Erupt(name = "分组")
@Table(name = "ma_group",uniqueConstraints = {
        @UniqueConstraint(columnNames = "name")
})
@Entity
@DynamicUpdate
public class Group extends HyperModel {
    /**
     * name
     */
    @EruptField(
            views = @View(title = "名称"),
            edit = @Edit(title = "名称")
    )
    private String name;

    @EruptField(
            views = @View(title = "位置"),
            edit = @Edit(title = "位置")
    )
    private Integer position = 100;

    @EruptField(
            views = @View(title = "删除"),
            edit = @Edit(title = "删除",readOnly = true)
    )
    @Column
    @TableLogic
    @JsonIgnore
    private Short removed = 0;

}
